#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["XfTechOAWeb.ApiServer/XfTechOAWeb.ApiServer.csproj", "XfTechOAWeb.ApiServer/"]
COPY ["XfTechOAWeb.Dtos/XfTechOAWeb.Dtos.csproj", "XfTechOAWeb.Dtos/"]
COPY ["XfTechOAWeb.Infrastructure/XfTechOAWeb.Infrastructure.csproj", "XfTechOAWeb.Infrastructure/"]
COPY ["XfTechOAWeb.Models/XfTechOAWeb.Models.csproj", "XfTechOAWeb.Models/"]
COPY ["XfTechOAWeb.EFCore/XfTechOAWeb.EFCore.csproj", "XfTechOAWeb.EFCore/"]
COPY ["XfTechOAWeb.Data/XfTechOAWeb.Data.csproj", "XfTechOAWeb.Data/"]
COPY ["XfTechOAWeb.IService/XfTechOAWeb.IService.csproj", "XfTechOAWeb.IService/"]
COPY ["XfTechOAWeb.Service/XfTechOAWeb.Service.csproj", "XfTechOAWeb.Service/"]
RUN dotnet restore "XfTechOAWeb.ApiServer/XfTechOAWeb.ApiServer.csproj"
COPY . .
WORKDIR "/src/XfTechOAWeb.ApiServer"
RUN dotnet build "XfTechOAWeb.ApiServer.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "XfTechOAWeb.ApiServer.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "XfTechOAWeb.ApiServer.dll"]